<?php
class Demo4 extends CI_Model{

	function __construct(){

		parent::__construct();
		
		$this->load->database();

	}
	
	
	function client_insert($arr){
		$this->db->insert('j_client',$arr);
		return $this->db->insert_id(); //获得刚刚新增记录的id
		
	}
	
	function client_update($id,$arr)
	{
		$this->db->where('id',$id);
		$this->db->update('j_client',$arr);
	}
	
	function client_delete($id){
		$this->db->where('id',$id);
		$this->db->delete('j_client');
	}
	
	function client_select($id){
		$this->db->where('id',$id);
		$this->db->select('*');
		$query = $this->db->get('j_client');
		return  $query->result();
	}
	
	public function getTest(){
		$id = $this->input->get('id');
		return $id;
	}

	function read($id){
		$this->load->database ();
		//$query = $this->db->get('j_user',$id);
		$rs = $this->db->simple_query("select * from j_client where id =".$id);
		$result = $rs->fetchAll();
		return $result;//这里返回的是一个数组，可以通过$query['id'],$query['title']//进行访问
		

		

	}




}